﻿using BLL.Interfaces;
using GUI.Models.AdminModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace GUI.Controllers
{
    public class AdministateurController : Controller
    {
        //
        // GET: /Administateur/
      private readonly  IArticlesServices    articleservices;
      public AdministateurController(IArticlesServices    _articleservices)
      {
          this.articleservices = _articleservices;
      }

        public ActionResult GetArticles()
        {

            var articles = articleservices.GetArticle().Select(a => new ArticleModelAdmin
            { 
             Id=a.Id,
             AuteurId=a.AuteurId,
             CreationDate=a.CreationDate,UpdateDate=a.UpdateDate,Title=a.Title,IsActive=a.IsActive,ArticleContenent=a.ArticleContenent,
             ImageBytes=a.ImageBytes,ImageUrl=a.UrlImage,Themes=a.themes,
             auteur=a.Auteur
            
            
            
            }).ToList();



            return View(articles);
        }


        public ActionResult Index()
        {

            return View();
        }

    }
}
